package io.renren.com.qywt.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.renren.com.qywt.dao.SupplierDao;
import io.renren.com.qywt.dto.SupplierDTO;
import io.renren.commons.dynamic.datasource.annotation.DataSource;
import io.renren.commons.mybatis.service.impl.BaseServiceImpl;
import io.renren.commons.tools.page.PageData;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class WmsSupplierServiceImpl extends BaseServiceImpl<SupplierDao, SupplierDTO> {
    @DataSource("slave1")
    public PageData<SupplierDTO> page(Map<String, Object> params) {
        //转换成like
        paramsToLike(params, "shortName");
        //分页
        IPage<SupplierDTO> page = getPage(params, "t1.fCreateDate", true);
        //查询
        List<SupplierDTO> list = baseDao.getList(params);
        return getPageData(list, page.getTotal(), SupplierDTO.class);
    }
}
